package com.windy.dailynews.ui.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.windy.dailynews.R;
import com.windy.dailynews.model.Themes;

import java.util.List;

/**
 * Created by dingfeng on 2016/11/22.
 */
public class SlideMenuAdapter extends BaseListAdapter<Themes> {

    public SlideMenuAdapter(Context context, List<Themes> list) {
        super(context, list);
    }

    @Override
    public View bindView(int position, View convertView, ViewGroup parent) {
        Themes theme = mList.get(position);
        ViewHolder holder;
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.item_slide_menu, parent, false);
            holder = new ViewHolder();
            holder.tv_title = (TextView) convertView.findViewById(R.id.tv_title);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        holder.tv_title.setText(theme.getName());

        return convertView;
    }

    class ViewHolder {
        TextView tv_title;
    }

}
